home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Updaters / WhiteCap 3.2.2.sea / WhiteCap 3.2.2 / WhiteCap Source / DirectX3 SDK / inc / dsound.h < prev    next >
Text File  |  1996-09-04  |  27KB  |  606 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1995,1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dsound.h
  6.  *  Content:    DirectSound include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef __DSOUND_INCLUDED__
  11. #define __DSOUND_INCLUDED__
  12.  
  13. #include <d3dtypes.h>
  14.  
  15. #ifdef _WIN32
  16. #define COM_NO_WINDOWS_H
  17. #include <objbase.h>
  18. #endif
  19.  
  20. #define _FACDS  0x878
  21. #define MAKE_DSHRESULT( code )  MAKE_HRESULT( 1, _FACDS, code )
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. // Direct Sound Component GUID    {47D4D946-62E8-11cf-93BC-444553540000}
  28. DEFINE_GUID(CLSID_DirectSound,
  29. 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
  30.  
  31. // DirectSound 279afa83-4981-11ce-a521-0020af0be560
  32. DEFINE_GUID(IID_IDirectSound,0x279AFA83,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  33. // DirectSoundBuffer 279afa85-4981-11ce-a521-0020af0be560
  34. DEFINE_GUID(IID_IDirectSoundBuffer,0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  35.  
  36. //DirectSound3DListener 279afa84-4981-11ce-a521-0020af0be560
  37. DEFINE_GUID(IID_IDirectSound3DListener,0x279AFA84,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  38. //DirectSound3DBuffer 279afa86-4981-11ce-a521-0020af0be560
  39. DEFINE_GUID(IID_IDirectSound3DBuffer,0x279AFA86,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  40.  
  41.  
  42. //==========================================================================;
  43. //
  44. //                            Structures...
  45. //
  46. //==========================================================================;
  47. #ifdef __cplusplus
  48. /* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */
  49. struct IDirectSound;
  50. struct IDirectSoundBuffer;
  51. struct IDirectSound3DListener;
  52. struct IDirectSound3DBuffer;
  53. #endif
  54.  
  55. typedef struct IDirectSound           *LPDIRECTSOUND;        
  56. typedef struct IDirectSoundBuffer     *LPDIRECTSOUNDBUFFER;  
  57. typedef struct IDirectSoundBuffer    **LPLPDIRECTSOUNDBUFFER;  
  58. typedef struct IDirectSound3DListener         *LPDIRECTSOUND3DLISTENER;
  59. typedef struct IDirectSound3DBuffer   *LPDIRECTSOUND3DBUFFER;
  60.  
  61.  
  62. typedef struct _DSCAPS
  63. {
  64.     DWORD       dwSize;
  65.     DWORD       dwFlags;
  66.     DWORD       dwMinSecondarySampleRate;
  67.     DWORD       dwMaxSecondarySampleRate;
  68.     DWORD       dwPrimaryBuffers;
  69.     DWORD       dwMaxHwMixingAllBuffers;
  70.     DWORD       dwMaxHwMixingStaticBuffers;
  71.     DWORD       dwMaxHwMixingStreamingBuffers;
  72.     DWORD       dwFreeHwMixingAllBuffers;
  73.     DWORD       dwFreeHwMixingStaticBuffers;
  74.     DWORD       dwFreeHwMixingStreamingBuffers;
  75.     DWORD       dwMaxHw3DAllBuffers;
  76.     DWORD       dwMaxHw3DStaticBuffers;
  77.     DWORD       dwMaxHw3DStreamingBuffers;
  78.     DWORD       dwFreeHw3DAllBuffers;
  79.     DWORD       dwFreeHw3DStaticBuffers;
  80.     DWORD       dwFreeHw3DStreamingBuffers;
  81.     DWORD       dwTotalHwMemBytes;
  82.     DWORD       dwFreeHwMemBytes;
  83.     DWORD       dwMaxContigFreeHwMemBytes;
  84.     DWORD       dwUnlockTransferRateHwBuffers;
  85.     DWORD       dwPlayCpuOverheadSwBuffers;
  86.     DWORD       dwReserved1;
  87.     DWORD       dwReserved2;
  88. } DSCAPS, *LPDSCAPS;
  89.  
  90. typedef struct _DSBCAPS
  91. {
  92.     
  93.     DWORD       dwSize;
  94.     DWORD       dwFlags;
  95.     DWORD       dwBufferBytes;
  96.     DWORD       dwUnlockTransferRate;
  97.     DWORD       dwPlayCpuOverhead;
  98. } DSBCAPS, *LPDSBCAPS;
  99.  
  100. typedef struct _DSBUFFERDESC
  101. {
  102.     DWORD                   dwSize;
  103.     DWORD                   dwFlags;
  104.     DWORD                   dwBufferBytes;
  105.     DWORD                   dwReserved;
  106.     LPWAVEFORMATEX          lpwfxFormat;
  107. } DSBUFFERDESC, *LPDSBUFFERDESC;
  108.  
  109. typedef struct _DS3DBUFFER
  110. {
  111.     DWORD       dwSize;
  112.     D3DVECTOR   vPosition;
  113.     D3DVECTOR   vVelocity;
  114.     DWORD       dwInsideConeAngle;
  115.     DWORD       dwOutsideConeAngle;
  116.     D3DVECTOR   vConeOrientation;
  117.     LONG        lConeOutsideVolume;
  118.     D3DVALUE    flMinDistance;
  119.     D3DVALUE    flMaxDistance;
  120.     DWORD       dwMode;
  121. } DS3DBUFFER, *LPDS3DBUFFER;
  122.  
  123. typedef struct _DS3DLISTENER
  124. {
  125.     DWORD       dwSize;
  126.     D3DVECTOR   vPosition;
  127.     D3DVECTOR   vVelocity;
  128.     D3DVECTOR   vOrientFront;
  129.     D3DVECTOR   vOrientTop;
  130.     D3DVALUE    flDistanceFactor;
  131.     D3DVALUE    flRolloffFactor;
  132.     D3DVALUE    flDopplerFactor;
  133. } DS3DLISTENER, *LPDS3DLISTENER;
  134.  
  135.  
  136.  
  137. typedef LPVOID* LPLPVOID;
  138.  
  139.  
  140. typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKW)(const GUID FAR *, LPWSTR, LPWSTR, LPVOID);
  141. typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKA)(const GUID FAR *, LPSTR, LPSTR, LPVOID);
  142.  
  143. extern HRESULT WINAPI DirectSoundCreate(const GUID * lpGUID, LPDIRECTSOUND * ppDS, IUnknown FAR *pUnkOuter );
  144. extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, LPVOID lpContext );
  145. extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext );
  146.  
  147. #ifdef UNICODE
  148. #define LPDSENUMCALLBACK        LPDSENUMCALLBACKW
  149. #define DirectSoundEnumerate    DirectSoundEnumerateW
  150. #else
  151. #define LPDSENUMCALLBACK        LPDSENUMCALLBACKA
  152. #define DirectSoundEnumerate    DirectSoundEnumerateA
  153. #endif
  154.  
  155. //
  156. // IDirectSound
  157. //
  158. #undef INTERFACE
  159. #define INTERFACE IDirectSound
  160. #ifdef _WIN32
  161. DECLARE_INTERFACE_( IDirectSound, IUnknown )
  162. {
  163.     /*** IUnknown methods ***/
  164.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  165.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  166.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  167.     /*** IDirectSound methods ***/
  168.  
  169.     STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE;
  170.     STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE;
  171.     STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE;
  172.     STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE;
  173.     STDMETHOD( Compact)(THIS ) PURE;
  174.     STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE;
  175.     STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE;
  176.     STDMETHOD( Initialize)(THIS_ const GUID * ) PURE;
  177. };
  178.  
  179. #if !defined(__cplusplus) || defined(CINTERFACE)
  180. #define IDirectSound_QueryInterface(p,a,b)       (p)->lpVtbl->QueryInterface(p,a,b)
  181. #define IDirectSound_AddRef(p)                   (p)->lpVtbl->AddRef(p)
  182. #define IDirectSound_Release(p)                  (p)->lpVtbl->Release(p)
  183. #define IDirectSound_CreateSoundBuffer(p,a,b,c)  (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
  184. #define IDirectSound_GetCaps(p,a)                (p)->lpVtbl->GetCaps(p,a)
  185. #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
  186. #define IDirectSound_SetCooperativeLevel(p,a,b)  (p)->lpVtbl->SetCooperativeLevel(p,a,b)
  187. #define IDirectSound_Compact(p)                  (p)->lpVtbl->Compact(p)
  188. #define IDirectSound_GetSpeakerConfig(p,a)       (p)->lpVtbl->GetSpeakerConfig(p,a)
  189. #define IDirectSound_SetSpeakerConfig(p,b)       (p)->lpVtbl->SetSpeakerConfig(p,b)
  190. #define IDirectSound_Initialize(p,a)             (p)->lpVtbl->Initialize(p,a)
  191. #else
  192. #define IDirectSound_QueryInterface(p,a,b)       (p)->QueryInterface(a,b)
  193. #define IDirectSound_AddRef(p)                   (p)->AddRef()
  194. #define IDirectSound_Release(p)                  (p)->Release()
  195. #define IDirectSound_CreateSoundBuffer(p,a,b,c)  (p)->CreateSoundBuffer(a,b,c)
  196. #define IDirectSound_GetCaps(p,a)                (p)->GetCaps(a)
  197. #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b)
  198. #define IDirectSound_SetCooperativeLevel(p,a,b)  (p)->SetCooperativeLevel(a,b)
  199. #define IDirectSound_Compact(p)                  (p)->Compact()
  200. #define IDirectSound_GetSpeakerConfig(p,a)       (p)->GetSpeakerConfig(a)
  201. #define IDirectSound_SetSpeakerConfig(p,b)       (p)->SetSpeakerConfig(b)
  202. #define IDirectSound_Initialize(p,a)             (p)->Initialize(a)
  203. #endif
  204.  
  205. #endif
  206.  
  207. //
  208. // IDirectSoundBuffer
  209. //
  210. #undef INTERFACE
  211. #define INTERFACE IDirectSoundBuffer
  212. #ifdef _WIN32
  213. DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown )
  214. {
  215.     /*** IUnknown methods ***/
  216.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  217.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  218.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  219.     /*** IDirectSoundBuffer methods ***/
  220.  
  221.     STDMETHOD(           GetCaps)(THIS_ LPDSBCAPS ) PURE;
  222.     STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE;
  223.     STDMETHOD(         GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
  224.     STDMETHOD(         GetVolume)(THIS_ LPLONG ) PURE;
  225.     STDMETHOD(            GetPan)(THIS_ LPLONG ) PURE;
  226.     STDMETHOD(      GetFrequency)(THIS_ LPDWORD ) PURE;
  227.     STDMETHOD(         GetStatus)(THIS_ LPDWORD ) PURE;
  228.     STDMETHOD(        Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE;
  229.     STDMETHOD(              Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE;
  230.     STDMETHOD(              Play)(THIS_ DWORD,DWORD,DWORD ) PURE;
  231.     STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE;
  232.     STDMETHOD(         SetFormat)(THIS_ LPWAVEFORMATEX ) PURE;
  233.     STDMETHOD(         SetVolume)(THIS_ LONG ) PURE;
  234.     STDMETHOD(            SetPan)(THIS_ LONG ) PURE;
  235.     STDMETHOD(      SetFrequency)(THIS_ DWORD ) PURE;
  236.     STDMETHOD(              Stop)(THIS  ) PURE;
  237.     STDMETHOD(            Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE;
  238.     STDMETHOD(           Restore)(THIS  ) PURE;
  239. };
  240.  
  241. #if !defined(__cplusplus) || defined(CINTERFACE)
  242. #define IDirectSoundBuffer_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
  243. #define IDirectSoundBuffer_AddRef(p)                    (p)->lpVtbl->AddRef(p)
  244. #define IDirectSoundBuffer_Release(p)                   (p)->lpVtbl->Release(p)
  245. #define IDirectSoundBuffer_GetCaps(p,a)                 (p)->lpVtbl->GetCaps(p,a)
  246. #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)    (p)->lpVtbl->GetCurrentPosition(p,a,b)
  247. #define IDirectSoundBuffer_GetFormat(p,a,b,c)           (p)->lpVtbl->GetFormat(p,a,b,c)
  248. #define IDirectSoundBuffer_GetVolume(p,a)               (p)->lpVtbl->GetVolume(p,a)
  249. #define IDirectSoundBuffer_GetPan(p,a)                  (p)->lpVtbl->GetPan(p,a)
  250. #define IDirectSoundBuffer_GetFrequency(p,a)            (p)->lpVtbl->GetFrequency(p,a)
  251. #define IDirectSoundBuffer_GetStatus(p,a)               (p)->lpVtbl->GetStatus(p,a)
  252. #define IDirectSoundBuffer_Initialize(p,a,b)            (p)->lpVtbl->Initialize(p,a,b)
  253. #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)        (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
  254. #define IDirectSoundBuffer_Play(p,a,b,c)                (p)->lpVtbl->Play(p,a,b,c)
  255. #define IDirectSoundBuffer_SetCurrentPosition(p,a)      (p)->lpVtbl->SetCurrentPosition(p,a)
  256. #define IDirectSoundBuffer_SetFormat(p,a)               (p)->lpVtbl->SetFormat(p,a)
  257. #define IDirectSoundBuffer_SetVolume(p,a)               (p)->lpVtbl->SetVolume(p,a)
  258. #define IDirectSoundBuffer_SetPan(p,a)                  (p)->lpVtbl->SetPan(p,a)
  259. #define IDirectSoundBuffer_SetFrequency(p,a)            (p)->lpVtbl->SetFrequency(p,a)
  260. #define IDirectSoundBuffer_Stop(p)                      (p)->lpVtbl->Stop(p)
  261. #define IDirectSoundBuffer_Unlock(p,a,b,c,d)            (p)->lpVtbl->Unlock(p,a,b,c,d)
  262. #define IDirectSoundBuffer_Restore(p)                   (p)->lpVtbl->Restore(p)
  263. #else
  264. #define IDirectSoundBuffer_QueryInterface(p,a,b)        (p)->QueryInterface(a,b)
  265. #define IDirectSoundBuffer_AddRef(p)                    (p)->AddRef()
  266. #define IDirectSoundBuffer_Release(p)                   (p)->Release()
  267. #define IDirectSoundBuffer_GetCaps(p,a)                 (p)->GetCaps(a)
  268. #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)    (p)->GetCurrentPosition(a,b)
  269. #define IDirectSoundBuffer_GetFormat(p,a,b,c)           (p)->GetFormat(a,b,c)
  270. #define IDirectSoundBuffer_GetVolume(p,a)               (p)->GetVolume(a)
  271. #define IDirectSoundBuffer_GetPan(p,a)                  (p)->GetPan(a)
  272. #define IDirectSoundBuffer_GetFrequency(p,a)            (p)->GetFrequency(a)
  273. #define IDirectSoundBuffer_GetStatus(p,a)               (p)->GetStatus(a)
  274. #define IDirectSoundBuffer_Initialize(p,a,b)            (p)->Initialize(a,b)
  275. #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)        (p)->Lock(a,b,c,d,e,f,g)
  276. #define IDirectSoundBuffer_Play(p,a,b,c)                (p)->Play(a,b,c)
  277. #define IDirectSoundBuffer_SetCurrentPosition(p,a)      (p)->SetCurrentPosition(a)
  278. #define IDirectSoundBuffer_SetFormat(p,a)               (p)->SetFormat(a)
  279. #define IDirectSoundBuffer_SetVolume(p,a)               (p)->SetVolume(a)
  280. #define IDirectSoundBuffer_SetPan(p,a)                  (p)->SetPan(a)
  281. #define IDirectSoundBuffer_SetFrequency(p,a)            (p)->SetFrequency(a)
  282. #define IDirectSoundBuffer_Stop(p)                      (p)->Stop()
  283. #define IDirectSoundBuffer_Unlock(p,a,b,c,d)            (p)->Unlock(a,b,c,d)
  284. #define IDirectSoundBuffer_Restore(p)                   (p)->Restore()
  285. #endif
  286.  
  287. #endif
  288.  
  289. //
  290. // IDirectSound3DListener
  291. //
  292. #undef INTERFACE
  293. #define INTERFACE IDirectSound3DListener
  294. #ifdef _WIN32
  295. DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown)
  296. {
  297.     /*** IUnknown methods ***/
  298.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  299.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  300.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  301.  
  302.     /*** IDirectSound3D methods ***/
  303.     STDMETHOD(GetAllParameters)(THIS_ LPDS3DLISTENER) PURE;
  304.     STDMETHOD(GetDistanceFactor)(THIS_ LPD3DVALUE) PURE;
  305.     STDMETHOD(GetDopplerFactor)(THIS_ LPD3DVALUE) PURE;
  306.     STDMETHOD(GetOrientation)(THIS_ LPD3DVECTOR, LPD3DVECTOR) PURE;
  307.     STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE;
  308.     STDMETHOD(GetRolloffFactor)(THIS_ LPD3DVALUE ) PURE;
  309.     STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE;
  310.     STDMETHOD(SetAllParameters)(THIS_ LPDS3DLISTENER, DWORD) PURE;
  311.     STDMETHOD(SetDistanceFactor)(THIS_ D3DVALUE, DWORD) PURE;
  312.     STDMETHOD(SetDopplerFactor)(THIS_ D3DVALUE, DWORD) PURE;
  313.     STDMETHOD(SetOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  314.     STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  315.     STDMETHOD(SetRolloffFactor)(THIS_ D3DVALUE, DWORD) PURE;
  316.     STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  317.     STDMETHOD(CommitDeferredSettings)(THIS) PURE;
  318. };
  319.  
  320. #if !defined(__cplusplus) || defined(CINTERFACE)
  321. #define IDirectSound3DListener_QueryInterface(p,a,b)            (p)->lpVtbl->QueryInterface(p,a,b)
  322. #define IDirectSound3DListener_AddRef(p)                        (p)->lpVtbl->AddRef(p)
  323. #define IDirectSound3DListener_Release(p)                       (p)->lpVtbl->Release(p)
  324. #define IDirectSound3DListener_GetAllParameters(p,a)            (p)->lpVtbl->GetAllParameters(p,a)
  325. #define IDirectSound3DListener_GetDistanceFactor(p,a)           (p)->lpVtbl->GetDistanceFactor(p,a)
  326. #define IDirectSound3DListener_GetDopplerFactor(p,a)            (p)->lpVtbl->GetDopplerFactor(p,a)
  327. #define IDirectSound3DListener_GetOrientation(p,a,b)            (p)->lpVtbl->GetOrientation(p,a,b)
  328. #define IDirectSound3DListener_GetPosition(p,a)                 (p)->lpVtbl->GetPosition(p,a)
  329. #define IDirectSound3DListener_GetRolloffFactor(p,a)            (p)->lpVtbl->GetRolloffFactor(p,a)
  330. #define IDirectSound3DListener_GetVelocity(p,a)                 (p)->lpVtbl->GetVelocity(p,a)
  331. #define IDirectSound3DListener_SetAllParameters(p,a,b)          (p)->lpVtbl->SetAllParameters(p,a,b)
  332. #define IDirectSound3DListener_SetDistanceFactor(p,a,b)         (p)->lpVtbl->SetDistanceFactor(p,a,b)
  333. #define IDirectSound3DListener_SetDopplerFactor(p,a,b)          (p)->lpVtbl->SetDopplerFactor(p,a,b)
  334. #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g)  (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g)
  335. #define IDirectSound3DListener_SetPosition(p,a,b,c,d)           (p)->lpVtbl->SetPosition(p,a,b,c,d)
  336. #define IDirectSound3DListener_SetRolloffFactor(p,a,b)          (p)->lpVtbl->SetRolloffFactor(p,a,b)
  337. #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)           (p)->lpVtbl->SetVelocity(p,a,b,c,d)
  338. #define IDirectSound3DListener_CommitDeferredSettings(p)        (p)->lpVtbl->CommitDeferredSettings(p)
  339. #else
  340. #define IDirectSound3DListener_QueryInterface(p,a,b)            (p)->QueryInterface(a,b)
  341. #define IDirectSound3DListener_AddRef(p)                        (p)->AddRef()
  342. #define IDirectSound3DListener_Release(p)                       (p)->Release()
  343. #define IDirectSound3DListener_GetAllParameters(p,a)            (p)->GetAllParameters(a)
  344. #define IDirectSound3DListener_GetDistanceFactor(p,a)           (p)->GetDistanceFactor(a)
  345. #define IDirectSound3DListener_GetDopplerFactor(p,a)            (p)->GetDopplerFactor(a)
  346. #define IDirectSound3DListener_GetOrientation(p,a,b)            (p)->GetOrientation(a,b)
  347. #define IDirectSound3DListener_GetPosition(p,a)                 (p)->GetPosition(a)
  348. #define IDirectSound3DListener_GetRolloffFactor(p,a)            (p)->GetRolloffFactor(a)
  349. #define IDirectSound3DListener_GetVelocity(p,a)                 (p)->GetVelocity(a)
  350. #define IDirectSound3DListener_SetAllParameters(p,a,b)          (p)->SetAllParameters(a,b)
  351. #define IDirectSound3DListener_SetDistanceFactor(p,a,b)         (p)->SetDistanceFactor(a,b)
  352. #define IDirectSound3DListener_SetDopplerFactor(p,a,b)          (p)->SetDopplerFactor(a,b)
  353. #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g)  (p)->SetOrientation(a,b,c,d,e,f,g)
  354. #define IDirectSound3DListener_SetPosition(p,a,b,c,d)           (p)->SetPosition(a,b,c,d)
  355. #define IDirectSound3DListener_SetRolloffFactor(p,a,b)          (p)->SetRolloffFactor(a,b)
  356. #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)           (p)->SetVelocity(a,b,c,d)
  357. #define IDirectSound3DListener_CommitDeferredSettings(p)        (p)->CommitDeferredSettings()
  358. #endif
  359.  
  360. #endif
  361.  
  362. //
  363. // IDirectSound3DBuffer
  364. //
  365. #undef INTERFACE
  366. #define INTERFACE IDirectSound3DBuffer
  367. #ifdef _WIN32
  368. DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown)
  369. {
  370.     /*** IUnknown methods ***/
  371.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  372.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  373.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  374.  
  375.     /*** IDirectSoundBuffer3D methods ***/
  376.     STDMETHOD(GetAllParameters)(THIS_ LPDS3DBUFFER) PURE;
  377.     STDMETHOD(GetConeAngles)(THIS_ LPDWORD, LPDWORD) PURE;
  378.     STDMETHOD(GetConeOrientation)(THIS_ LPD3DVECTOR) PURE;
  379.     STDMETHOD(GetConeOutsideVolume)(THIS_ LPLONG) PURE;
  380.     STDMETHOD(GetMaxDistance)(THIS_ LPD3DVALUE) PURE;
  381.     STDMETHOD(GetMinDistance)(THIS_ LPD3DVALUE) PURE;
  382.     STDMETHOD(GetMode)(THIS_ LPDWORD) PURE;
  383.     STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE;
  384.     STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE;
  385.     STDMETHOD(SetAllParameters)(THIS_ LPDS3DBUFFER, DWORD) PURE;
  386.     STDMETHOD(SetConeAngles)(THIS_ DWORD, DWORD, DWORD) PURE;
  387.     STDMETHOD(SetConeOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  388.     STDMETHOD(SetConeOutsideVolume)(THIS_ LONG, DWORD) PURE;
  389.     STDMETHOD(SetMaxDistance)(THIS_ D3DVALUE, DWORD) PURE;
  390.     STDMETHOD(SetMinDistance)(THIS_ D3DVALUE, DWORD) PURE;
  391.     STDMETHOD(SetMode)(THIS_ DWORD, DWORD) PURE;
  392.     STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  393.     STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  394. };
  395.  
  396. #if !defined(__cplusplus) || defined(CINTERFACE)
  397. #define IDirectSound3DBuffer_QueryInterface(p,a,b)      (p)->lpVtbl->QueryInterface(p,a,b)
  398. #define IDirectSound3DBuffer_AddRef(p)                  (p)->lpVtbl->AddRef(p)
  399. #define IDirectSound3DBuffer_Release(p)                 (p)->lpVtbl->Release(p)
  400. #define IDirectSound3DBuffer_GetAllParameters(p,a)      (p)->lpVtbl->GetAllParameters(p,a)
  401. #define IDirectSound3DBuffer_GetConeAngles(p,a,b)       (p)->lpVtbl->GetConeAngles(p,a,b)
  402. #define IDirectSound3DBuffer_GetConeOrientation(p,a)    (p)->lpVtbl->GetConeOrientation(p,a)
  403. #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)  (p)->lpVtbl->GetConeOutsideVolume(p,a)
  404. #define IDirectSound3DBuffer_GetPosition(p,a)           (p)->lpVtbl->GetPosition(p,a)
  405. #define IDirectSound3DBuffer_GetMinDistance(p,a)        (p)->lpVtbl->GetMinDistance(p,a)
  406. #define IDirectSound3DBuffer_GetMaxDistance(p,a)        (p)->lpVtbl->GetMaxDistance(p,a)
  407. #define IDirectSound3DBuffer_GetMode(p,a)               (p)->lpVtbl->GetMode(p,a)
  408. #define IDirectSound3DBuffer_GetVelocity(p,a)           (p)->lpVtbl->GetVelocity(p,a)
  409. #define IDirectSound3DBuffer_SetAllParameters(p,a,b)    (p)->lpVtbl->SetAllParameters(p,a,b)
  410. #define IDirectSound3DBuffer_SetConeAngles(p,a,b,c)     (p)->lpVtbl->SetConeAngles(p,a,b,c)
  411. #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d)
  412. #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->lpVtbl->SetConeOutsideVolume(p,a,b)
  413. #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)     (p)->lpVtbl->SetPosition(p,a,b,c,d)
  414. #define IDirectSound3DBuffer_SetMinDistance(p,a,b)      (p)->lpVtbl->SetMinDistance(p,a,b)
  415. #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)      (p)->lpVtbl->SetMaxDistance(p,a,b)
  416. #define IDirectSound3DBuffer_SetMode(p,a,b)             (p)->lpVtbl->SetMode(p,a,b)
  417. #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)     (p)->lpVtbl->SetVelocity(p,a,b,c,d)
  418. #else
  419. #define IDirectSound3DBuffer_QueryInterface(p,a,b)      (p)->QueryInterface(a,b)
  420. #define IDirectSound3DBuffer_AddRef(p)                  (p)->AddRef()
  421. #define IDirectSound3DBuffer_Release(p)                 (p)->Release()
  422. #define IDirectSound3DBuffer_GetAllParameters(p,a)      (p)->GetAllParameters(a)
  423. #define IDirectSound3DBuffer_GetConeAngles(p,a,b)       (p)->GetConeAngles(a,b)
  424. #define IDirectSound3DBuffer_GetConeOrientation(p,a)    (p)->GetConeOrientation(a)
  425. #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)  (p)->GetConeOutsideVolume(a)
  426. #define IDirectSound3DBuffer_GetPosition(p,a)           (p)->GetPosition(a)
  427. #define IDirectSound3DBuffer_GetMinDistance(p,a)        (p)->GetMinDistance(a)
  428. #define IDirectSound3DBuffer_GetMaxDistance(p,a)        (p)->GetMaxDistance(a)
  429. #define IDirectSound3DBuffer_GetMode(p,a)               (p)->GetMode(a)
  430. #define IDirectSound3DBuffer_GetVelocity(p,a)           (p)->GetVelocity(a)
  431. #define IDirectSound3DBuffer_SetAllParameters(p,a,b)    (p)->SetAllParameters(a,b)
  432. #define IDirectSound3DBuffer_SetConeAngles(p,a,b,c)     (p)->SetConeAngles(a,b,c)
  433. #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d)
  434. #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->SetConeOutsideVolume(a,b)
  435. #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)     (p)->SetPosition(a,b,c,d)
  436. #define IDirectSound3DBuffer_SetMinDistance(p,a,b)      (p)->SetMinDistance(a,b)
  437. #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)      (p)->SetMaxDistance(a,b)
  438. #define IDirectSound3DBuffer_SetMode(p,a,b)             (p)->SetMode(a,b)
  439. #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)     (p)->SetVelocity(a,b,c,d)
  440. #endif
  441.  
  442. #endif
  443.  
  444.  
  445. /*
  446.  * Return Codes
  447.  */
  448.  
  449. #define DS_OK                           0
  450.  
  451. /*
  452.  * The call failed because resources (such as a priority level)
  453.  *  were already being used by another caller.
  454.  */
  455. #define DSERR_ALLOCATED                 MAKE_DSHRESULT( 10 )
  456. /*
  457.  * The control (vol,pan,etc.) requested by the caller is not available.
  458.  */
  459. #define DSERR_CONTROLUNAVAIL            MAKE_DSHRESULT( 30 )
  460. /*
  461.  * An invalid parameter was passed to the returning function
  462.  */
  463. #define DSERR_INVALIDPARAM              E_INVALIDARG
  464. /*
  465.  * This call is not valid for the current state of this object
  466.  */
  467. #define DSERR_INVALIDCALL               MAKE_DSHRESULT( 50 )
  468. /*
  469.  * An undetermined error occured inside the DSound subsystem
  470.  */
  471. #define DSERR_GENERIC                   E_FAIL
  472. /*
  473.  * The caller does not have the priority level required for the function to
  474.  * succeed.
  475.  */
  476. #define DSERR_PRIOLEVELNEEDED           MAKE_DSHRESULT( 70 )
  477. /*
  478.  * The DSound subsystem couldn't allocate sufficient memory to complete the
  479.  * caller's request.
  480.  */
  481. #define DSERR_OUTOFMEMORY               E_OUTOFMEMORY
  482. /*
  483.  * The specified WAVE format is not supported
  484.  */
  485. #define DSERR_BADFORMAT                 MAKE_DSHRESULT( 100 )
  486. /*
  487.  * The function called is not supported at this time
  488.  */
  489. #define DSERR_UNSUPPORTED               E_NOTIMPL
  490. /*
  491.  * No sound driver is available for use
  492.  */
  493. #define DSERR_NODRIVER                  MAKE_DSHRESULT( 120 )
  494. /*
  495.  * This object is already initialized
  496.  */
  497. #define DSERR_ALREADYINITIALIZED        MAKE_DSHRESULT( 130 )
  498. /*
  499.  * This object does not support aggregation
  500.  */
  501. #define DSERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
  502. /*
  503.  * The buffer memory has been lost, and must be Restored.
  504.  */
  505. #define DSERR_BUFFERLOST                MAKE_DSHRESULT( 150 )
  506. /*
  507.  * Another app has a higher priority level, preventing this call from
  508.  * succeeding.
  509.  */
  510. #define DSERR_OTHERAPPHASPRIO           MAKE_DSHRESULT( 160 )
  511. /*
  512.  * The Initialize() member on the Direct Sound Object has not been
  513.  * called or called successfully before calls to other members.
  514.  */
  515. #define DSERR_UNINITIALIZED             MAKE_DSHRESULT( 170 )
  516.  
  517.  
  518.  
  519.  
  520. //==========================================================================;
  521. //
  522. //                               Flags...
  523. //
  524. //==========================================================================;
  525.  
  526. #define DSCAPS_PRIMARYMONO          0x00000001
  527. #define DSCAPS_PRIMARYSTEREO        0x00000002
  528. #define DSCAPS_PRIMARY8BIT          0x00000004
  529. #define DSCAPS_PRIMARY16BIT         0x00000008
  530. #define DSCAPS_CONTINUOUSRATE       0x00000010
  531. #define DSCAPS_EMULDRIVER           0x00000020
  532. #define DSCAPS_CERTIFIED            0x00000040
  533. #define DSCAPS_SECONDARYMONO        0x00000100
  534. #define DSCAPS_SECONDARYSTEREO      0x00000200
  535. #define DSCAPS_SECONDARY8BIT        0x00000400
  536. #define DSCAPS_SECONDARY16BIT       0x00000800
  537.  
  538.  
  539.  
  540. #define DSBPLAY_LOOPING                 0x00000001
  541.  
  542.           
  543. #define DSBSTATUS_PLAYING           0x00000001
  544. #define DSBSTATUS_BUFFERLOST        0x00000002
  545. #define DSBSTATUS_LOOPING           0x00000004
  546.          
  547.  
  548. #define DSBLOCK_FROMWRITECURSOR         0x00000001
  549.  
  550.  
  551.  
  552. #define DSSCL_NORMAL                1
  553. #define DSSCL_PRIORITY              2
  554. #define DSSCL_EXCLUSIVE             3
  555. #define DSSCL_WRITEPRIMARY          4
  556.  
  557.  
  558.  
  559. // flags for IDirectSound3DBuffer::SetMode
  560. #define DS3DMODE_NORMAL         0       // default must be 0
  561. #define DS3DMODE_HEADRELATIVE   1
  562. #define DS3DMODE_DISABLE        2
  563.  
  564. // flags for dwApply parameter of some 3D functions
  565. #define DS3D_IMMEDIATE          0
  566. #define DS3D_DEFERRED           1
  567.  
  568. // default values for 3d factors
  569. #define DS3D_DEFAULTDISTANCEFACTOR      1.0f
  570. #define DS3D_DEFAULTROLLOFFFACTOR       1.0f
  571. #define DS3D_DEFAULTDOPPLERFACTOR       1.0f
  572.  
  573. #define DSBCAPS_PRIMARYBUFFER       0x00000001
  574. #define DSBCAPS_STATIC              0x00000002
  575. #define DSBCAPS_LOCHARDWARE         0x00000004
  576. #define DSBCAPS_LOCSOFTWARE         0x00000008
  577. #define DSBCAPS_CTRL3D              0x00000010
  578. #define DSBCAPS_CTRLFREQUENCY       0x00000020
  579. #define DSBCAPS_CTRLPAN             0x00000040
  580. #define DSBCAPS_CTRLVOLUME          0x00000080
  581. #define DSBCAPS_CTRLDEFAULT         0x000000E0  // Pan + volume + frequency.
  582. #define DSBCAPS_CTRLALL             0x000000F0  // All control capabilities
  583. #define DSBCAPS_STICKYFOCUS         0x00004000
  584. #define DSBCAPS_GLOBALFOCUS         0x00008000 
  585. #define DSBCAPS_GETCURRENTPOSITION2 0x00010000  // More accurate play cursor under emulation
  586.  
  587.  
  588.  
  589.  
  590. #define DSSPEAKER_HEADPHONE     1
  591. #define DSSPEAKER_MONO          2
  592. #define DSSPEAKER_QUAD          3
  593. #define DSSPEAKER_STEREO        4
  594. #define DSSPEAKER_SURROUND      5
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601. #ifdef __cplusplus
  602. };
  603. #endif
  604.  
  605. #endif  /* __DSOUND_INCLUDED__ */
  606.